//-----------------------------------------------------------------------
// <copyright file="TwitterContext.cs" company="Rhys Parry">
//    Copyright Rhys Parry 2009
//    This file is released under the Apache 2.0 License
// </copyright>
//-----------------------------------------------------------------------
namespace Smarts.Services.Twitter
{
    using System.Collections.Generic;
    using Core.Interfaces;

    public class TwitterContext
    {
        private IWebAccessor _webAccessor;
        private IUser _self;

        public TwitterContext(IWebAccessor webAccessor)
        {
            _webAccessor = webAccessor;
        }

        public IEnumerable<IStatus> PublicTimeline
        {
            get
            {
                return new List<IStatus>();
            }
        }

        public IEnumerable<IStatus> FriendsTimeline
        {
            get
            {
                return Self.FriendsTimeline;
            }
        }

        public IEnumerable<IStatus> UserTimeline
        {
            get
            {
                return Self.UserTimeline;
            }
        }

        public IEnumerable<IStatus> Mentions
        {
            get
            {
                return Self.Mentions;
            }
        }

        public IEnumerable<IUser> Friends
        {
            get
            {
                return Self.Friends;
            }
        }

        public IEnumerable<IUser> Followers
        {
            get
            {
                return Self.Followers;
            }
        }

        public IEnumerable<Status> Favorites
        {
            get
            {
                return Self.Favorites;
            }
        }

        public IUser Self
        {
            get
            {
                return _self;
            }
        }

        public IUser AuthenticateAs(string username, string password)
        {
            _webAccessor.UseCredentials(username, password);
            return _self = new User(username);
        }
    }
}